# -*- coding: utf-8 -*-

from django.conf import settings

def check_new_ants(type_ant, num_ants, base):
    cost = 0
    if type_ant == 'W':
        cost = settings.COST_RESOURCES[0]
    elif type_ant == 'OO':
        cost = settings.COST_RESOURCES[1]
    elif type_ant == 'OD':
        cost = settings.COST_RESOURCES[2]
    elif type_ant == 'FO':
        cost = settings.COST_RESOURCES[3]
    elif type_ant == 'FD':
        cost = settings.COST_RESOURCES[4]
    elif type_ant == 'Q':
        cost = settings.COST_RESOURCES[5]
        #cost = 500 # provisional

    cost = cost * num_ants

    if base.resources < cost:
        raise Exception(u'No tienes suficientes recursos.')
    else:
        base.resources -= cost
        base.save()

